package online.sixfish.doubao.enumration;

import java.util.Arrays;
import java.util.List;

public enum RoleEnum {
    ADMIN(1, "管理员","admin"),
    USER(2, "用户","user");

    private final int id;
    private final String desc;

    private final String authority;

    RoleEnum(int id, String desc,String authority) {
        this.id = id;
        this.desc = desc;
        this.authority=authority;
    }

    public int getId() {
        return id;
    }

    public String getDesc() {
        return desc;
    }
    public String getAuthority() {
        return authority;
    }

    public static RoleEnum getById(int id) {
        for (RoleEnum role : RoleEnum.values()) {
            if (id == role.id) {
                return role;
            }
        }
        return null;
    }

    public static List<RoleEnum> getAllRoles() {
        return Arrays.asList(RoleEnum.values());
    }


}
